{extend name="common:base" /}
{block name="body"}
<div class="x-nav">
    <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">内容管理</a>
        <a>
            <cite>幻灯片管理</cite></a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
        onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn"
                        onclick="xadmin.full('添加','{:url(\'content_add_pretties\',[\'type\'=>$type])}')"><i
                            class="layui-icon"></i>添加</button>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th width="40">ID</th>
                                <th width="120">图片</th>
                                <th width="200">标题</th>
                                <th width="200">描述</th>
                                <th>路径</th>
                                <th width="70">创建时间</th>
                                <th width="70">排序</th>
                                <th width="40">状态</th>
                                <th width="120">操作</th>
                        </thead>
                        <tbody>
                            {notempty name="data.data"}
                            {volist name="data.data" id="vo"}
                            <tr>
                                <td>{$vo.id}</td>
                                <td>
                                    <span style="width: 100px;height: 100px;display: inline-block">
                                        <img src="{$vo.desktop}" alt="" style="width: 100%;height: 100%">
                                    </span>
                                </td>
                                <td>{$vo.title}</td>
                                <td>{$vo.description}</td>
                                <td>{$vo.path}</td>
                                <td>{notempty name="vo.create_time"}{$vo.create_time|date="Y-m-d"}{/notempty}</td>
                                <td><input type="text" name="listorder" value="{$vo.listorder}" class="layui-input">
                                </td>
                                <td class="td-status">
                                    {if($vo.status == 1)}
                                    <button class="layui-btn layui-btn-normal layui-btn-mini">启用</button>
                                    {else /}
                                    <button class="layui-btn layui-btn-danger layui-btn-mini">禁用</button>
                                    {/if}
                                </td>
                                <td class="td-manage">
                                    <button class="layui-btn layui-btn layui-btn-xs"
                                        onclick="xadmin.full('编辑','{:url(\'content_edit_pretties\',[\'id\'=>$vo.id])}')">
                                        <i class="layui-icon">&#xe642;</i>编辑
                                    </button>
                                    {if($vo.status == 2 )}
                                    <button class="layui-btn layui-btn-normal layui-btn-mini"
                                        onclick="changeStatus('{:url(\'content_change_pretties\',[\'id\'=>$vo.id,\'status\'=>1])}')">启用</button>
                                    {else /}
                                    <button class="layui-btn layui-btn-danger layui-btn-mini"
                                        onclick="changeStatus('{:url(\'content_change_pretties\',[\'id\'=>$vo.id,\'status\'=>2])}')">禁用</button>
                                    {/if}
                                </td>
                            </tr>
                            {/volist}
                            {/notempty}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page" id="page"></div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="javascript"}
<script src="{{admin}}/js/common.js"></script>
<script>
    layui.use(['laypage'], function () {
        var laypage = layui.laypage;
        laypage.render({
            elem: 'page',
            count: '{$data.total}',
            limit: '{$data.per_page}',
            curr: '{$data.current_page}',
            jump: function (obj, first) {
                if (!first) {
                    location.href = '?page=' + obj.curr;
                }
            }
        });
    });
</script>
{/block}